package models;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import javax.swing.JButton;

import models.msgs.*;
import models.msgs.Number;
import play.Logger;
import play.mvc.*;
import play.libs.*;
import play.libs.F.*;
import scala.concurrent.Await;
import scala.concurrent.duration.Duration;
import akka.actor.*;
import static akka.pattern.Patterns.ask;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.node.ArrayNode;

import static java.util.concurrent.TimeUnit.*;

public class Human extends UntypedActor {
    public final String name;
    public final ActorRef table;

    protected WebSocket.In<JsonNode> in;
    protected WebSocket.Out<JsonNode> out;
    private boolean isreadyauction;
    private boolean youcanauction;
     private boolean isreadychangecard;
     private boolean youcanchangecard;
   
 
  
	//private boolean isready;
   private String selectaction;
   private Integer mynumeron;
   @SuppressWarnings("unused")
	private boolean firstaction;
   private boolean iscard1;
   private boolean iscard2;
    private boolean iscard3;
    private boolean iscard4; 
//
	private String oldaction;
	private String mycondition;
   private Integer maxgolden;
   private Integer  howgold;
   private Integer mygold;
  private Integer mytimeingame;
  private Boolean connection;
	private Integer mygoldingame;
  private Integer playersn;
	
  // private boolean connection;
   private boolean longround;

    public Human(String _name, WebSocket.In<JsonNode> _in,
                 WebSocket.Out<JsonNode> _out, ActorRef _table) {
        name = _name;
        table = _table;
        in = _in;
        out = _out;


        in.onMessage(new Callback<JsonNode>() {
            @Override
            public void invoke(JsonNode event) {
                try {
                    int nr = event.get("nr").asInt();
                    getSelf().tell(new Number(nr, name), getSelf());
                } catch (Exception e) {
                    Logger.error("invokeError");
                }

            }
        });

        in.onClose(new Callback0() {
            @Override
            public void invoke() {
                table.tell(new Quit(name), getSelf());
            }
        });
    }

    @Override
    public void preStart() {
        String text = "my Actor is now running!";
        table.tell(new Info(text, name), getSelf());
    }

    @Override
    public void postStop() {
        String text = "I've been killed";
        table.tell(new Info(text, name), getSelf());
    }

    @Override
    public void onReceive(Object msg) throws Exception {

        if (msg instanceof Number) {
            int nr = ((Number) msg).getNumber();
            String text = "I've got the number " + nr + " fromsss WebSocket and send it to Table";
            table.tell(new Info(text, name), getSelf());
            table.tell(new Number(nr, name), getSelf());
        } else if (msg instanceof Card) {
            Card card = (Card) msg;
            String text = "I've got " + card.getRank() + " " + card.getColor() + " from Table";
            table.tell(new Info(text, name), getSelf());
        } else if (msg instanceof Info) {
            Info info = (Info) msg;
            ObjectNode event = Json.newObject();
            event.put("message", "[ " + info.getName() + " ] : " + info.getText());

            out.write(event);
        } else {
            unhandled(msg);
        }

    }
    
    
    
    public void actionPerformed(ActionEvent e) 
	{   connection=true;
        if("Dołącz do gry".equals(Bok.getText()) || "Czekaj, jeśli chcesz".equals(Bok.getText()) || "Server długo odpowiada. Spróbuj innego".equals(Bok.getText()) || "Problem z połączeniem z serwerem. Spróbuj jeszcze raz".equals(Bok.getText()) || "Błędny numer portu".equals(Bok.getText())  )  
        { if("Czekaj, jeśli chcesz".equals(Bok.getText()) )  {Linfo.setText("Connect??");  connection=false; }
        	else {Linfo.setText("Connect");  connection=false; }
        	}
	   else  if("Zatwierdz wymiane kart".equals(Bok.getText())) 
	   					{ isreadychangecard=true;
	   					  youcanchangecard=false;
	   					
	   				     setTextB("Bok","Czekaj"); 
	   					}
	   else  if("Zatwierdz akcje licytacji".equals(Bok.getText())) 
			{ if(!selectaction.equals("empty") ){
				 setTextB("Bok","Czekaj");
			 
			  getButton(selectaction).setBackground(Color.white); 
			    
				
			     if(selectaction.equals("Bet"))
				  {  mygold=mygold-howgold; mygoldingame=mygoldingame+howgold;  setmaxGolden(mygoldingame);   }
				else if(selectaction.equals("Raise"))
				  {  mygold=mygold-howgold; mygoldingame=mygoldingame+howgold;  setmaxGolden(mygoldingame);      }
				
				else if(selectaction.equals("Call"))
				  { mygold=mygold-(maxgolden-mygoldingame); mygoldingame=maxgolden;      }
				else if(selectaction.equals("Allin"))
				  {  mygoldingame=mygoldingame+mygold; mygold=0;;      }
		
			   
			     
		    	  setTextL("Linfomygoldingame2", Integer.toString(mygoldingame));
		       	  setTextL("Linfomywallet2", Integer.toString(mygold));
		    	
		       	  setTextL("Linfomaxgold2",Integer.toString(maxgolden));
		       	 setTextL("Linfo",selectaction);
		       	 isreadyauction=true;
				  youcanauction=false;
			  
			 }else setTextL("Lifno","Brak wybranej akcji");

			}

	}
     
     
     
     
     public class CardsbuttonListener implements ActionListener{
        
         
        
 		@Override
 		public void actionPerformed(ActionEvent event) {
 			
 			
 			if(youcanchangecard==true)
 			{ String whatcard= event.getActionCommand();
 				
 				if(whatcard.equals(Bcard1.getText()))
 			 		{ if(iscard1==false)
			 			{
					     Bcard1.setBackground(Color.red); 
				         iscard1=true;
			 			}
 			 		else {iscard1=false;
 			 		     
				          Bcard1.setBackground(Color.white); 
 			 			 }
 			 		}
 			    else  if(whatcard.equals(Bcard2.getText()))
 		 		{
 			    	 if(iscard2==false)
			 			{
					     Bcard2.setBackground(Color.red); 
				         iscard2=true;
			 			}
			 		else {iscard2=false;
		 		    
			          Bcard2.setBackground(Color.white); 
		 			 }
 		 		}
 			 	else if(whatcard.equals(Bcard3.getText()))
 		 		{
 			 		 if(iscard3==false)
			 			{
					     Bcard3.setBackground(Color.red); 
				         iscard3=true;
			 			}
			 		else{iscard3=false;
		 		     
			          Bcard3.setBackground(Color.white); 
		 			 }
 		 		}
 		        else  if(whatcard.equals(Bcard4.getText()))
 		 		{
 		        	 if(iscard4==false)
			 			{
					     Bcard4.setBackground(Color.red); 
				         iscard4=true;
			 			}
			 		else {iscard4=false;
		 		      
			          Bcard4.setBackground(Color.white); 
		 			 }
 		 		}
 			}
 		}

     }
     
     
     
     public class AuctionbuttonListener implements ActionListener{
         
         
    	 // JButton: Bok,Bcheck, Bbet,Braise, Bcall, Bfold, Ballin;
  		@Override
  		public void actionPerformed(ActionEvent event) {
  			
  			if(youcanauction==true && !getTextLtabel(mynumeron,1).equals("Fold") && !getTextLtabel(mynumeron,1).equals("Allin") && !getTextLtabel(mynumeron,1).equals("niekatywny") )
 			{ String whataction= event.getActionCommand();
 			
 			 try{
 				 howgold=0;
 			//	 setTextB("Bcard1","true");
 				 mygold=Integer.parseInt(getTextL("Linfomywallet2"));
 				
 			     mygoldingame=Integer.parseInt(getTextLtabel(mynumeron,3));
 			     
 			     mytimeingame=Integer.parseInt(getTextLtabel(mynumeron,5));
 			    int k; if(mynumeron-1>0){ k=mynumeron-1;} else{ k=playersn;}
 			     mycondition=getTextLtabel(mynumeron,1);
 			    if(mytimeingame!=1) {if(mynumeron-1>0) oldaction=getTextLtabel(mynumeron-1,1); else oldaction=getTextLtabel(playersn,1); }else oldaction="empty";
 			    while((oldaction.equals("Fold") || oldaction.equals("Allin")) && k!=mynumeron) {  if(mytimeingame!=1) {if(k-1>0) oldaction=getTextLtabel(k-1,1); else oldaction=getTextLtabel(playersn,1); }else oldaction="empty";    if(k-1>0){ k=k-1;} else{ k=playersn;}}
 				if(whataction.equals("Check"))
 				  {
 					selectaction=Bcheckaction(whataction,  selectaction, mygoldingame, maxgolden,  mytimeingame, longround, oldaction,  mycondition);
 					
 				  }
 				else if(whataction.equals("Bet"))
				  { 
 					 try{howgold=0;
 	 				 
 					 	howgold=Integer.parseInt(getTextF());
 					 	selectaction=Bbetaction(whataction,  selectaction,  mytimeingame, longround, oldaction,maxgolden,  mygoldingame,  howgold,mygold);
 					 	}
 					 catch(NumberFormatException e)
 				      {selectaction="empty";  Bbet.setBackground(Color.white);}
 					
 				     }
 				else if(whataction.equals("Raise"))
				  {   
 						try{howgold=0;
 	 				 
 						howgold=Integer.parseInt(getTextF());
 						selectaction=Braiseaction(whataction, selectaction, mytimeingame,  longround, oldaction, maxgolden,  mygoldingame, howgold, mygold);
 						}
 					 catch(NumberFormatException e)
 				      { selectaction="empty";  Braise.setBackground(Color.white);}
 					
 					    }
 				else if(whataction.equals("Fold"))
				  {   selectaction=Bfoldaction( whataction,  selectaction);   }
 				else if(whataction.equals("Call"))
				  {     selectaction=Bcallaction(whataction,  selectaction, oldaction, maxgolden,  mygoldingame, mygold);    }
 				else if(whataction.equals("Allin"))
				  {  selectaction=Ballin(whataction,  selectaction,  mygold);     }
 				
 				
 		     }
			 catch(NumberFormatException e)
			      { //setTextL("Linfo","Błąd danych");
			      }	
 				
 				
 		  }
  		}

      }
     
     
     
  
     
     public String Bcheckaction(String whataction2, String selectaction, Integer mygold, Integer maxgolden, Integer mytimeingame, Boolean longround, String oldaction, String mycondition)
     {    
    	 if(selectaction.equals("empty"))  
			{  if(mytimeingame==1)
					{  if(longround==false )
						{selectaction=whataction2;
						
						Bcheck.setBackground(Color.red); 
	 		      
						}
			    
				}
				else 
			   
		   		{ if(oldaction.equals("Check")  )
	  			 {selectaction=whataction2;  Bcheck.setBackground(Color.red); }
		   		 else  if(mygoldingame==maxgolden && mycondition.equals("Dużą ciemną dał"))
		   			 
		   		  {selectaction=whataction2;  Bcheck.setBackground(Color.red); }
		   		  // else  Linfo.setText(mycondition + mygoldingame + maxgolden);
			  
		   		}
			}
     		else  {if(whataction2.equals(selectaction) )  
			 		{
     				selectaction="empty";
	    		
     				Bcheck.setBackground(Color.white); 
			 		}
     			}
    		
     return selectaction;
    	 
     }  
     
     
     public String Bbetaction(String whataction2, String selectaction, Integer mytimeingame, Boolean longround, String oldaction, Integer maxgolden, Integer mygoldingame, Integer howgold, Integer mygold)
     {
    	 Integer var;
    	 
    	 
    	 if(selectaction.equals("empty"))  
			
    	 		{ 
    	 		var=maxgolden-mygoldingame;
    		 
    		    if(howgold>var && howgold<mygold)
    		 
    		 			
    		 		{
    		 			  if(mytimeingame==1)
    	 					{  if( longround==false )
    	 						{   selectaction=whataction2;
						            
    	 							Bbet.setBackground(Color.red); 
	 		      
    	 							}
			    
    	 					}	
    	 					else 
			   
    	 						{ if(oldaction.equals("Check")  )
    	 							{selectaction=whataction2;
		   		 
    	 							Bbet.setBackground(Color.red); 
    	 							}
			  
    	 						}
    	 					
    	 				
    		 		} else if(howgold>0 && mygold<=howgold) 
    		 							{
    		 			                 selectaction="Allin";
    		 			                 Ballin.setBackground(Color.red); 
    		 			                 setTextL("Linfo","Podana suma, pozwala zagrać jedynie Wszystko");
    		 							}
    		 		else if(howgold==var && var>0)
    	 							{ selectaction="Call";
    	 								Bcall.setBackground(Color.red); 
    	 									setTextL("Linfo","Podana suma, pozwala wyrównać");
    	 			
    	 							}
    		    
    		    
    		    
    	 		
    	 		}
     			else  {if(whataction2.equals(selectaction) )  
			 			{
     					selectaction="empty";
	    		        howgold=0;
     					Bbet.setBackground(Color.white); 
			 			}

     				
     				}
    	 return selectaction;
     }  
     
     
     
     
     
     public String Braiseaction(String whataction2, String selectaction, Integer mytimeingame, Boolean longround, String oldaction, Integer maxgolden, Integer mygoldingame, Integer howgold, Integer mygold)
     {Integer var;
    	 if(selectaction.equals("empty"))  
    	 {	
 	 		 var=maxgolden-mygoldingame;
	 		 if(howgold>var && howgold<mygold  )
	    		 
	 			{
	 			 
	 			 if(mytimeingame==1)
					{  if( longround==false )
						    { selectaction="Bet";
				            
							Bbet.setBackground(Color.red); 
	      
							}
					  else  { selectaction=whataction2;
						    Braise.setBackground(Color.red);
						 
						   
						   }
	    
						}
					else 
	   
						{ if(oldaction.equals("check")  )
							{selectaction="Bet";
		 
							Bbet.setBackground(Color.red); 
							}
						
						else 
 							{ selectaction=whataction2;
 							Braise.setBackground(Color.red);
						 
 							
 							}
	  
						}
	 			
 				
	 			} 
	 		else if(howgold>0 && mygold<=howgold) 
	 							{
	 			                 selectaction="Allin";
	 			                 Ballin.setBackground(Color.red); 
	 			                 setTextL("Linfo","Podana suma, pozwala zagrać jedynie Wszystko");
	 							}
	 		else if(howgold==var && var>0)
	 			{ selectaction="Call";
                 Bcall.setBackground(Color.red); 
                 setTextL("Linfo","Podana suma, pozwala wyrównać");
	 			
	 			}
    		 
	 		
    	 
        }
    	 
    	 else     {if(whataction2.equals(selectaction) )  
					{
    		 		selectaction="empty";
    		 		
    		 		Braise.setBackground(Color.white); 
					}
    	      }

    	 		
    	 
	  
    	 return selectaction; 
     }
     
     
     
     public String Bcallaction(String whataction2, String selectaction, String oldaction, Integer maxgolden, Integer mygoldingame, Integer mygold)
     {Integer var;
    	 if(selectaction.equals("empty"))  
 			
	 		{ var=maxgolden-mygoldingame;
    		  if(var>0 && mygold-var>0 )
	    		 
	 			
	 			{
 				   selectaction=whataction2;
 						 Bcall.setBackground(Color.red);
					
 				
	 			} 
	 		else if(mygold-var==0) 
	 							{
	 			                 selectaction="Allin";
	 			                 Ballin.setBackground(Color.red); 
	 			                 setTextL("Linfo","Podana akcja, pozwala zagrać jedynie Wszystko");
	 							}
    		 
	 		}
    	 
    	 else  {if(whataction2.equals(selectaction) )  
				{
    		 		selectaction="empty";
    		 		
    		 		Bcall.setBackground(Color.white); 
					}

    	        }
    	 
	  
    	 return selectaction; 
     }
     
     
     
     
     public String Bfoldaction(String whataction2, String selectaction)
     {
    	 if(selectaction.equals("empty"))  
 			
	 		{selectaction=whataction2;
			 Bfold.setBackground(Color.red);
    		 
	 		}
    	 
    	 else {if(whataction2.equals(selectaction) )  
				{
    		 		selectaction="empty";
    		 		
    		 		Bfold.setBackground(Color.white); 
					}

    	 		
    	      }
	  
    	 return selectaction;
     }
     
     
     
     
     
     
     
     

     public String Ballin(String whataction2, String selectaction, Integer mygold)
     {
    	 if(selectaction.equals("empty"))  
 			
	 		{
    		 if(mygold>0)
    		 	{
    		 	selectaction=whataction2;
    		 	Ballin.setBackground(Color.red);
    		 	}
	 		}
    	 
    	 else  {if(whataction2.equals(selectaction) )  
				{   Ballin.setBackground(Color.white);
    		 		selectaction="empty";
    		 		
    		 		
					}

    	        }
    	 
	  
    	 return selectaction; 
     }
     
     
     
     
     
     
     public JButton getButton(String name)
     {
    	 if( name.equals("Check"))
    	   	   return Bcheck;
    	         else   if( name.equals("Bok"))
    	       	  return Bok;
    	         else   if( name.equals("Bet"))
    	       	  return Bbet;
    	    
    	         else   if( name.equals("Raise"))
    	       	  return Braise;
    	         else   if( name.equals("Call"))
    	       	  return Bcall;
    	         else   if( name.equals("Fold"))
    	       	  return  Bfold;
    	         else   if( name.equals("Allin"))
    	       	  return  Ballin;
    	         else   if( name.equals("Bcard1"))
    	       	  return  Bcard1;
    	         else   if( name.equals("Bcard2"))
    	       	  return Bcard2;
    	         else   if( name.equals("Bcard3"))
    	       	  return Bcard3;
    	         else   if( name.equals("Bcard4"))
    	       	  return  Bcard4;
    	         else   return Bok;
     }
     
     

   
     
     public void setTextB(String name, String text)
     
     {  //   Button is Bok,Bcheck, Bbet,Braise, Bcall, Bfold, Ballin, Bcard1,Bcard2,Bcard3,Bcard4;; 
    	 
    	 if( name.equals("Bcheck"))
    	  Bcheck.setText(text);
          else   if( name.equals("Bok"))
        	  Bok.setText(text);
          else   if( name.equals("Bbet"))
        	  Bbet.setText(text);
     
          else   if( name.equals("Braise"))
        	  Braise.setText(text);
          else   if( name.equals("Bcall"))
        	  Bcall.setText(text);
          else   if( name.equals("Bfold"))
        	  Bfold.setText(text);
          else   if( name.equals("Ballin"))
        	  Ballin.setText(text);
          else   if( name.equals("Bcard1"))
        	  Bcard1.setText(text);
          else   if( name.equals("Bcard2"))
        	  Bcard2.setText(text);
          else   if( name.equals("Bcard3"))
        	  Bcard3.setText(text);
          else   if( name.equals("Bcard4"))
        	  Bcard4.setText(text);
    	 
    	 
     
         
    	 
     }
     
     public  void setTextL(String name, String text)
     
     { if( name.equals("Linfo"))
   	  Linfo.setText(text);
     else   if( name.equals("Linforunde"))
   	  Linforunde.setText(text);
     else   if( name.equals("Linforounde2"))
   	  Linforounde2.setText(text);
     else   if( name.equals("Linfomygoldingame"))
      	  Linfomygoldingame.setText(text);
     else   if( name.equals("Linfomygoldingame2"))
      	  Linfomygoldingame2.setText(text);
     else   if( name.equals("Linfomywallet"))
      	  Linfomywallet.setText(text);
     else   if( name.equals("Linfomywallet2"))
    	 Linfomywallet2.setText(text);
     else   if( name.equals("Linfomaxgold"))
     	  Linfomaxgold.setText(text);
    else   if( name.equals("Linfomaxgold2"))
    	Linfomaxgold2.setText(text);

   
    	 
     }
     
     public  void setTextLtabel( String text, int a, int b  )
     
     {if( b>=0 && b<=5  && a >=0 && a <=7 )
      	   Lplayer[a][b].setText(text);
        
    	    
    	 
     }
     
     
 public void setTextF( String text)
     
     {
    	    Ttext.setText(text);
    	 
     }
 
 public String getTextB(String name)
 
 {
	 if( name.equals("Bcheck"))
   	   return Bcheck.getText();
         else   if( name.equals("Bok"))
       	  return Bok.getText();
         else   if( name.equals("Bbet"))
       	  return Bbet.getText();
    
         else   if( name.equals("Braise"))
       	  return Braise.getText();
         else   if( name.equals("Bcall"))
       	  return Bcall.getText();
         else   if( name.equals("Bfold"))
       	  return  Bfold.getText();
         else   if( name.equals("Ballin"))
       	  return  Ballin.getText();
         else   if( name.equals("Bcard1"))
       	  return  Bcard1.getText();
         else   if( name.equals("Bcard2"))
       	  return Bcard2.getText();
         else   if( name.equals("Bcard3"))
       	  return Bcard3.getText();
         else   if( name.equals("Bcard4"))
       	  return  Bcard4.getText();
         else   return badandugly;
   	 
	 
 }
 
 public String getTextL(String name)
 
 {
	 if( name.equals("Linfo"))
	   	 return Linfo.getText();
	     else   if( name.equals("Linforunde"))
	   	  return Linforunde.getText();
	     else   if( name.equals("Linforounde2"))
	   	  return Linforounde2.getText();
	     else   if( name.equals("Linfomygoldingame"))
	      	return   Linfomygoldingame.getText();
	     else   if( name.equals("Linfomygoldingame2"))
	      return	  Linfomygoldingame2.getText();
	     else   if( name.equals("Linfomywallet"))
	      return	  Linfomywallet.getText();
	     else   if( name.equals("Linfomywallet2"))
	    	return Linfomywallet2.getText();
	     else   if( name.equals("Linfomaxgold"))
	      return	  Linfomaxgold.getText();
	    else   if( name.equals("Linfomaxgold2"))
	    	return Linfomaxgold2.getText();
	     
	     else return badandugly;
	  
 }
 
public String getTextLtabel( int a, int b  )
 
 {if( b>=0 && b<=5  && a >=0 && a <=7 )
  	  return Lplayer[a][b].getText();
    else  return badandugly;
	    
	 
 }
 
public String getTextF()
 
 {
	   return Ttext.getText();
	 
 }

public void   setColorL(int a, int b)

{

		     Lplayer[a][b].setBackground(Color.blue);    
	 
}


public void   setColorOpaque()

{  
	
for(int k=0; k<6; k++ )
{ for(int i=0; i<=6; i++ )
	{ Lplayer[i][k].setOpaque(true);
	 

	} 
  
}

		    
	 
}


public void   setColorLWhite()

{  for(int i=0; i<=6; i++)
	{ for(int j=0; j<=5; j++)
		{
		Lplayer[i][j].setBackground(Color.white);  
 
 
		}

	}

		    
	 
}

public void   setisreadyChangecard(String name)

{
	 if(name.equals("yes"))
	 { isreadychangecard=true;}
	 else {isreadychangecard=false;}
	 
}


public void   setyoucanChangecard(String name)

{
	 if(name.equals("yes"))
	 { youcanchangecard=true;}
	 else {youcanchangecard=false;}
	 
}

public void   setisreadyAuction(String name)

{
	 if(name.equals("yes"))
	 { isreadyauction=true;}
	 else {isreadyauction=false;}
	 
}


public void   setyoucanAuction(String name)

{
	 if(name.equals("yes"))
	 { youcanauction=true;}
	 else {youcanauction=false;}
	 
}


public void   setmyNumeron(Integer name)

{
	mynumeron=name;
	 
}

public void   setoldaction(String name)

{
	oldaction=name;
	 
}

public void   setmaxGolden(Integer name)

{
	maxgolden=name;
	 
}

public Integer  getmaxGolden()

{
	return maxgolden;
	 
}


public boolean  showyoucanAuction()

{
	 if( youcanauction==true)
	 { return true;}
	 else {return false;}
	 
}

public boolean  showisreadyAuction()

{
	 if( isreadyauction==true)
	 { return true;}
	 else {return false;}
	 
}

public boolean  showyoucanChangecard()

{
	 if( youcanchangecard==true)
	 { return true;}
	 else {return false;}
	 
}

public boolean  showisreadyChangecard()

{
	 if( isreadychangecard==true)
	 { return true;}
	 else {return false;}
	 
}

public boolean  showcarddelete(String namecardd)

{
	 if( namecardd.equals("iscard1"))
	 {  if( iscard1==true) { return true; } else {return false;}}
	 else if( namecardd.equals("iscard2"))
	    {  if( iscard2==true) { return true; } else {return false;}}
	 else if( namecardd.equals("iscard3"))
	    {  if( iscard3==true) { return true; } else {return false;}}   	     
	 else if( namecardd.equals("iscard4"))
	    {  if( iscard4==true) { return true; } else {return false;}}
	 
	 else return false;
	    
	 
}

public String  showauction()

{
	 return selectaction;
	    
	 
}

public void  setEmptyauction()

{
	 selectaction="empty";
	    
	 
}

public void  setEmptycardchange()

{    iscard1=false;
	 iscard2=false;
	 iscard3=false;   
	 iscard4=false;
}

public Integer  showhowgoldint()

{   int how=howgold;
	 return how;
	    
	 
}


public String  showhowgold()

{    String how=Integer.toString(howgold);
	 return how;
	    
	 
}


public void  setEmptyhowgold()

{     howgold=0;
      setTextF("");
	 
	    
	 
}
public void setlongFalse()
{
	longround=false;
}
public void setlongTrue()
{
	longround=true;
}



public void bota()
{
	
}
public void botc()
{
	
}


public Boolean getConnection()
{
	return connection;
}

public void plset(int plnumber)
{
	playersn=plnumber;
}

 

}

